home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / exampleCode / inventor / DirectManipTrackLight / TrackLight.iv < prev   
Encoding:
Text File  |  1994-08-02  |  3.3 KB  |  106 lines

  1. #Inventor V2.0 ascii
  2.  
  3. # By putting the light underneath a TransformSeparator,
  4. # the transforms have only a local effect, but the 
  5. # transformed light will affect objects outside the
  6. # TransformSeparator.
  7. TransformSeparator {
  8.  
  9.     # This Translate1Dragger/Translation pair serves
  10.     # to slide the plank left and right within the room
  11.     DEF PLANK_DRAGGER Translate1Dragger {
  12.     translation 0 20 0 
  13.     translator DEF PLANK_GEOM Separator {
  14.             Material { emissiveColor .1 .3 .3 }
  15.         Cube { width .5 height .5 depth 20 }
  16.     }
  17.     translatorActive USE PLANK_GEOM
  18.     }
  19.     Translation { translation = USE PLANK_DRAGGER . translation }
  20.  
  21.     # This rotated Translate1Dragger/Translation pair serves
  22.     # to slide the bulb socket forward and back along the plank
  23.     RotationXYZ { axis Y angle 1.57079 }
  24.     DEF SOCKET_DRAGGER Translate1Dragger {
  25.     translator DEF SOCKET_GEOM Separator {
  26.             Material { emissiveColor .3 .1 .3 }
  27.         Cylinder { radius .5 height 1 }
  28.     }
  29.     translatorActive USE SOCKET_GEOM
  30.     }
  31.     Translation { translation = USE SOCKET_DRAGGER . translation }
  32.  
  33.     # This RotateSphericalDragger/Rotation pair serves to rotate
  34.     # the bulb relative to its mount point in the bulb socket.
  35.     DEF BULB_DRAGGER RotateSphericalDragger {
  36.     rotation 1 0 0 -1.57079
  37.     rotator DEF BULB_GEOM Separator {
  38.             Material { emissiveColor .3 .3 .1 }
  39.         RotationXYZ { axis X angle 1.57079 }
  40.         Translation { translation 0 -1 0 }
  41.         Cone { height 2 }
  42.         Translation { translation 0 2 0 }
  43.         Cylinder { radius .1 height 2 }
  44.     }
  45.     rotatorActive USE BULB_GEOM
  46.     feedback Separator {}
  47.     feedbackActive Separator {}
  48.     }
  49.     Rotation { rotation = USE BULB_DRAGGER . rotation }
  50.  
  51.     # At this point, the light has been transformed by the
  52.     # preceding Translation and rotation nodes. So the light
  53.     # appears to emit from the conical BULB_DRAGGER
  54.     SpotLight { 
  55.  
  56.     # The intensity and cutOffAngle of the spotlight
  57.     # are controlled by the previously defined DIMMERs
  58.     # DecomposeVec3f engines extract the x values from their
  59.     # translations.
  60.     intensity = DecomposeVec3f { 
  61.             vector = DEF INTENSITY_DIMMER Translate1Dragger {
  62.                 # Start at intensity of .5
  63.                 translation .5 0 0 
  64.                 translator DEF DIMMER_GEOM Separator {
  65.                 Cube { width .2 height .2 depth .2 }
  66.                 }
  67.                 translatorActive USE DIMMER_GEOM
  68.             } . translation
  69.             } . x
  70.     cutOffAngle = DecomposeVec3f { 
  71.             vector = DEF ANGLE_DIMMER Translate1Dragger {
  72.                 # Start with angle of .5 radians
  73.                 translation .5 0 0 
  74.                 translator DEF ANGLE_DIMMER_GEOM Separator {
  75.                 RotationXYZ { axis Z angle -1.57079 }
  76.                 Cone { bottomRadius .1 height .2 }
  77.                 }
  78.                 translatorActive USE ANGLE_DIMMER_GEOM
  79.             } . translation
  80.             } . x
  81.     }
  82. }
  83.  
  84. # Draw the DIMMERs. They are arranged on a panel which remains
  85. # stationary when the track light parts are dragged around.
  86. Separator {
  87.     Transform { rotation 1 0 0 1.57079 translation 0 10 -10 scaleFactor 5 5 5 }
  88.     RotationXYZ { axis Y angle 1.57079 }
  89.  
  90.     # The panel 
  91.     Separator {
  92.     Material { diffuseColor .6 .6 1 emissiveColor .6 .6 1 }
  93.     Translation { translation .6 0 0 }    
  94.     Cube { width 1.2 height .01 depth .75 }
  95.     }
  96.  
  97.     # The Dimmers 
  98.     Separator {
  99.     Material { diffuseColor .25 .5 .25 emissiveColor .25 .5 .25 }
  100.     Translation { translation 0 0 -.25 }
  101.     USE INTENSITY_DIMMER
  102.     Translation { translation 0 0 .5 }
  103.     USE ANGLE_DIMMER
  104.     }
  105. }
  106.